package es.onlysolutions.gs.comm.filter;

import es.onlysolutions.arq.core.filter.CriteriaFilter;
import org.hibernate.criterion.Restrictions;

/**
 * filter for the video list. Will be the parent class for the filters to show or exclude
 * the videos of the current user.
 */
public abstract class VideoFilter extends CriteriaFilter
{

    private String title;
    private String content;

    public String getContent()
    {
        return content;
    }

    public void setContent(String content)
    {
        this.content = content;
        if( isEmptyOrWhiteSpace(content) )
        {
            addRestriction( Restrictions.ilike("content", "%" + content.toLowerCase() + "%" ) );
        }
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle(String title)
    {
        this.title = title;
        if( isEmptyOrWhiteSpace(title) )
        {
            addRestriction( Restrictions.ilike("title", "%" + title.toLowerCase() + "%" ) );
        }
    }


}
